<?php

declare(strict_types=1);

namespace App\Bac\Request\RBAC;

use Hyperf\Validation\Request\FormRequest;

class RolesRequest extends FormRequest
{
    protected array $scenes = [
        'add' => ['name','display_name','state'],
        'edit' => ['id','name','display_name'],
    ];
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'id' => "required|integer",
            'name' => "required|string",
            'display_name' => "required|string",
            'state' => "present",
        ];
    }
    public function messages(): array
    {
        return [
            'id.required' => "id必传",
            'name.required' => "缺少唯一标识",
            'display_name.required' => "角色名称为空",
        ];
    }
}
